* loaded by analysis.gms


PARAMETER
	Pagmipout%1(SCENARIO,Y,R,C_AGMIP,Title_Agmip,Value)
	Pagmipout%1(SCENARIO,Y,R,C_AGMIP,Title_Agmip,Value)
	Risk_agg%1(U,SCENARIO,R_agmip,Y)
	PCAL_agg%1(U,SCENARIO,R_agmip,Y)
;

$gdxin '../data/%1/final_results.gdx'
$load Pagmipout%1=Pagmipout_exe

$gdxin '../data/%1/AIMCGE_%1.gdx'
$load Risk_agg%1=Risk_agg
$load PCAL_agg%1=PCAL_agg

set
MAP_scneario%1(SCENARIO,Y,SSP,Sgcm,Srcp,co2fert,SYR,N)/
$offlisting
*$include ../define/MAP_scneario_%YTGT%co2.map
$ifthen %1==202050
$include ../define/map/2020.map
$include ../define/map/2050.map
$endif
$if %1==2030 $include ../define/map/2030.map
$if %1==2040 $include ../define/map/2040.map
$if %1==2050co2 $include ../define/map/2050co2.map
$if %1==2020SSP3 $include ../define/map/2020.map
$if %1==2030SSP3 $include ../define/map/2030.map
$if %1==2040SSP3 $include ../define/map/2040.map
$if %1==2050SSP3 $include ../define/map/2050SSP3.map
$if %1==2050SSP3co2 $include ../define/map/2050.map
$if %1==2030sens $include ../define/map/2030sens.map
$if %1==2040sens $include ../define/map/2040sens.map
$if %1==2050sens $include ../define/map/2050sens.map
$onlisting
/
;


Pagmipout(Y,R,SSP,Sgcm,Srcp,co2fert,SYR,N,C_AGMIP,Title_Agmip)$(N_out(N) and Title_Agmip_agg(Title_Agmip) and SUM(SCENARIO$(MAP_scneario%1(SCENARIO,Y,SSP,Sgcm,Srcp,co2fert,SYR,N)),Pagmipout%1(SCENARIO,Y,R,C_AGMIP,Title_Agmip,"dum")))
=SUM(SCENARIO$(MAP_scneario%1(SCENARIO,Y,SSP,Sgcm,Srcp,co2fert,SYR,N)),Pagmipout%1(SCENARIO,Y,R,C_AGMIP,Title_Agmip,"dum"));

Pagmipout1(Y,R_agmip,SSP,Sgcm,Srcp,co2fert,SYR,N,"AGR","POPU")$(N_out(N) and SUM(SCENARIO$(MAP_scneario%1(SCENARIO,Y,SSP,Sgcm,Srcp,co2fert,SYR,N)),Risk_agg%1("fao_based",SCENARIO,R_agmip,Y)))
=SUM(SCENARIO$(MAP_scneario%1(SCENARIO,Y,SSP,Sgcm,Srcp,co2fert,SYR,N)),Risk_agg%1("fao_based",SCENARIO,R_agmip,Y));

Pagmipout1(Y,R_agmip,SSP,Sgcm,Srcp,co2fert,SYR,N,"AGR","CALO")$(N_out(N) and SUM(SCENARIO$(MAP_scneario%1(SCENARIO,Y,SSP,Sgcm,Srcp,co2fert,SYR,N)),PCAL_agg%1("fao_based",SCENARIO,R_agmip,Y)))
=SUM(SCENARIO$(MAP_scneario%1(SCENARIO,Y,SSP,Sgcm,Srcp,co2fert,SYR,N)),PCAL_agg%1("fao_based",SCENARIO,R_agmip,Y));


$ontext
Execute_unload '..\temp\Pagmipout%1.gdx'
Risk_agg%1
PCAL_agg%1
Pagmipout1
Pagmipout
;
$offtext




